home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr49
/
actlib11.zip
/
DATE.ZIP
/
DATEVAL.C
next >
Wrap
Text File
|
1993-01-14
|
735b
|
41 lines
/* Copyright (C) 1993 Marc Stern (internet: stern@mble.philips.be) */
#include "date.h"
/***
*
* Function isdatevalid: return 1 if date is valid, 0 otherwise.
*
***/
int isdatevalid( int day , int month , int year )
{
if ( day <= 0 ) return 0 ;
switch( month )
{
case 1 :
case 3 :
case 5 :
case 7 :
case 8 :
case 10 :
case 12 : if ( day > 31 ) return 0 ; else return 1 ;
case 4 :
case 6 :
case 9 :
case 11 : if ( day > 30 ) return 0 ; else return 1 ;
case 2 : if ( day > 29 ) return 0 ;
if ( day < 29 ) return 1 ;
if ( isleapyear(year) ) return 1 ; /* leap year */
else return 0 ;
}
return 0 ;
}